package wlf.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import wlf.mapper.SpuMapper;
import wlf.pojo.Spu;
import wlf.pojo.Table;
import wlf.service.SpuService;

@Service
public class SpuServiceImpl implements SpuService{
	@Resource
	private SpuMapper spuMapper;
	@Override
	public Table<Spu> page(int page, int limit, Spu spu) {
		Table<Spu> table = new Table<>();
		table.setData(spuMapper.page((page-1)*limit, limit, spu));
		table.setCount(spuMapper.pageCount(spu));
		table.setMsg("success");
		table.setCode(0);
		return table;
	}

	@Override
	public int addSpu(Spu spu) {
		return spuMapper.insSpu(spu);
	}
	@Override
	public int updSpu(Spu spu) {
		return spuMapper.updSpu(spu);
	}
	@Override
	public int delSpu(int id) {
		return spuMapper.delSpu(id);
	}

	@Override
	public int updSpuStatus(int id, int status) {
		return spuMapper.updSpuStatus(id,status);
	}

	@Override
	public List<Spu> allSpu() {
		return spuMapper.selAll();
	}
	

}
